#include "cameradialog.h"
#include "ui_cameradialog.h"
#include <opencv/cv.h>
#include <camera/camerawindow.h>
#include <opencv/highgui.h>

CameraDialog::CameraDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CameraDialog)
{
    ui->setupUi(this);

    //CameraWindow *camwidget = new


    CvCapture * camera = cvCreateCameraCapture(1);

    assert(camera);
    IplImage * image=cvQueryFrame(camera);
    assert(image);

    printf("Image depth=%i\n", image->depth);
    printf("Image nChannels=%i\n", image->nChannels);

    CameraWindow *mainWin = new CameraWindow(camera,this);

    ui->dialogLayout->addWidget(mainWin);

    connect(mainWin, SIGNAL(error(QString)), this, SLOT(captureError(QString)));
}

CameraDialog::~CameraDialog()
{
    delete ui;
}
